package pta.test0607.统计一段文字中的单词个数;

import java.util.Iterator;
import java.util.Scanner;
import java.util.TreeSet;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        TreeSet<String> s = new TreeSet<>();
        while(true){
            String temp = sc.next();
            if (temp.equals("!!!!!"))
                break;
            s.add(temp);
        }
        System.out.println(s.size());
        Iterator<String> i=s.iterator();
        if(s.size()<10) {
            while(i.hasNext()) {
                System.out.println(i.next());
            }
        }
        else {
            for(int j=0;j<10;j++) {
                System.out.println(i.next());
            }
        }

    }
}
